// var http = require('http') ;

// http.createServer(function(req,res){
// 	res.writeHead(200,  {"Content-Type":  "text/plain"});
// 	res.write('Hello Danny.');
// 	res.end() ;
// }).listen(3000,function(req,res){
// 	console.log("Server is Ready...");
// }) ;

// var server = http.createServer() ;
// server.listen(3000) ;
// console.log("Server is Ready2...");

/*function say(word){
	console.log(word);
}

function execute(someFunction,value){
	someFunction(value) ;
}

execute(say,"Hello") ;*/


/*function execute(someFunction ,value){
	someFunction(value);
}

execute(function(word){
	console.log(word);
},"Hello") ;*/


var http = require('http') ;

var url = require('url') ;

function start(route,handle) {
	function onRequest(req,res){
		var pathname = url.parse(req.url).pathname;
		console.log("Request for "+pathname + "received.");
		// route(handle,pathname) ;
		res.writeHead(200,{"Content-Type":  "text/plain"}) ;
		var content = route(handle, pathname)
		// res.write("Hello World");
		res.write(content);
	  	res.end();
	}
	http.createServer(onRequest).listen(3000) ;
	console.log("Server has started.");
}
exports.start = start ;







